home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / C⁄C++ / Arashi 1.1 / Game Source / jaf src / Highmain.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-02  |  1.8 KB  |  95 lines  |  [TEXT/KAHL]

  1. /*
  2. **    List Highscores            //Jaf © copyright 1991
  3. */
  4.  
  5. /* va paketin numerot - scrollaus jos >40. SCROLLAUS */
  6. /* VA packet */
  7. #include "VA.h"
  8. #include "Palettes.h"
  9. #include "Highscores.h"
  10. #include "Flash.h"
  11. #include "PlayOptions.h"
  12.  
  13. Initials    *HiScores;
  14. extern int     SpecialEvent;
  15. extern int  FireworksActive;
  16.  
  17. HighMain() 
  18. {
  19.     Handle    ScoreHand;
  20.         
  21.     /* read scores from resources 
  22.     ScoreHand=GetResource('SCOR',128); */
  23.     if (PlayOptions->restart == 0)
  24.         ScoreHand=GetResource('SCOR',128);
  25.     else 
  26.         ScoreHand=GetResource('SCOR',129);
  27.     HLock(ScoreHand);
  28.     HiScores=(Initials *)*ScoreHand;
  29.     
  30.     DisplayScores();
  31.     SpecialEvent=DELAY;
  32.     FireworksActive=0;                    /*    */
  33. }        
  34.  
  35. DisplayScores()
  36. {
  37.     char    Pstring[255];
  38.     int        i,x,y,len;
  39.     char    *str;
  40.     Handle    TextHand;
  41.     char    *Text;
  42.  
  43.     if (PlayOptions->restart == 0)
  44.         TextHand=GetResource('TEXT',1001);
  45.     else 
  46.         TextHand=GetResource('TEXT',1011);
  47.     
  48.     HLock(TextHand);
  49.  
  50.     SetPort(VA.window);
  51.     PmForeColor(BG1);
  52.     PmBackColor(BGC);
  53.     
  54.     Text=(char *)*TextHand;
  55.     len=GetHandleSize(TextHand);
  56.     VA.segmscale=Getfontscale()+1;
  57.     y = VA.frame.bottom/6;
  58.     x = VA.frame.right/2 - (len*(VA.segmscale*3+3))/2;
  59.  
  60.     str = Text;
  61.     for(i=0;i<len;i++) {
  62.         if(*(str++) == 13) {
  63.             if(Text<str-1) {
  64.                 VAMoveTo(x,y);
  65.                 VA.color= BG2;
  66.                 VADrawText(Text,0,str-Text-1);                
  67.                 VAMoveTo(x+1,y);
  68.                 VA.color= BG2;
  69.                 VADrawText(Text,0,str-Text-1);                
  70.             }
  71.             y+=VA.segmscale * 10;
  72.             Text=str;
  73.         }
  74.     }
  75.  
  76.     for(i=1;i<11;i++) {
  77.         y = VA.frame.bottom/4 + Getfontscale() * 10 * i;
  78.         x = VA.frame.right/2;
  79.         VA.segmscale=Getfontscale();
  80.         VA.color=BG2;
  81.         VAMoveTo(x,y);
  82.         VADrawText(HiScores[i].name,0,5);
  83.         VA.segmscale=Getfontscale()*2;
  84.         VADrawNumber(HiScores[i].score,VA.frame.right/2.5,y);
  85.     }
  86.     return;
  87. }
  88.  
  89. Firework() {
  90.         VAExplosion(((unsigned int)Random()) %  VA.frame.right,
  91.             ((unsigned int)Random()) % VA.frame.bottom,2,
  92.             ((unsigned int)Random()) % 7);
  93.     return 1;
  94. }
  95.